package written_test;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.*;

/**
 * @author zhx
 * @since 2020-09-06
 */
public class TX {

    public static void main41(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        List<Integer> arr = new ArrayList<>();
        for (int i = 0; i < n; i++) {
//            arr[i] = in.nextInt();
            arr.add(in.nextInt());
        }
//        int middle = n / 2 - 1;
//        int left = 0;
//        int right = n -2;
//        while (left < middle || right > middle+1){
//            if (arr[left] > arr[middle]){
//                int tmp = arr[left];
//                arr[left] = arr[middle];
//                arr[middle] = tmp;
//            } else if (arr[left] > arr[middle+1]){
//                int tmp = arr[left];
//                arr[left] = arr[middle+1];
//                arr[middle+1] = tmp;
//            } else {
//                left++;
//            }
//
//            if (arr[right] < arr[middle]){
//                int tmp = arr[right];
//                arr[right] = arr[middle];
//                arr[middle] = tmp;
//            } else if(arr[right] < arr[middle+1]){
//                int tmp = arr[right];
//                arr[right] = arr[middle+1];
//                arr[middle+1] = tmp;
//            } else {
//                right--;
//            }
//
//        }
//        Arrays.sort(arr);

//        if (arr[middle] > arr[middle + 1]) {
//            int tmp = arr[middle];
//            arr[middle] = arr[middle + 1];
//            arr[middle + 1] = tmp;
//        }
//
//        for (int i = 0; i <= middle; i++) {
//            System.out.println(arr[middle + 1]);
//        }
//        for (int i = middle + 1; i < n; i++) {
//            System.out.println(arr[middle]);
//        }
        for (int i = 0; i < n; i++) {
            List<Integer> tmp = new ArrayList<>(arr);
            tmp.remove(i);
            int length = tmp.size();
            Collections.sort(tmp);
            System.out.println(tmp.get(length/2));

        }

        in.close();
    }

    public static void main1(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        Node head1 = new Node(-1);
        Node cur = head1;
        for (int i = 0; i < n; i++) {
            cur.next = new Node(sc.nextInt());
            cur = cur.next;
        }
        int m = sc.nextInt();
        Node head2 = new Node(-1);
        cur = head2;
        for (int i = 0; i < m; i++) {
            cur.next = new Node(sc.nextInt());
            cur = cur.next;
        }
        commonPrint(head1, head2);

    }

    public static void commonPrint(Node l1, Node l2) {
        Node cur1 = l1.next;
        Node cur2 = l2.next;
        StringBuilder res = new StringBuilder();
        while (cur1 != null && cur2 != null) {
            if (cur1.val == cur2.val) {
                res.append(cur1.val).append(" ");
                cur1 = cur1.next;
                cur2 = cur2.next;
            } else if (cur1.val > cur2.val) {
                cur1 = cur1.next;
            } else {
                cur2 = cur2.next;
            }
        }
        System.out.println(res.toString().trim());
    }

    // no.2
    public static void main2(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        List<List<Integer>> list = new ArrayList<>(m);
        for (int i = 0; i < m; i++) {
            int x = in.nextInt();
            List<Integer> team = new ArrayList<>(x);
            for (int j = 0; j < x; j++) {
                team.add(in.nextInt());
            }
            list.add(team);
        }
        in.close();
        Queue<Integer> notifyQueue = new LinkedList<>();
        notifyQueue.offer(0);
        Set<Integer> answer = new HashSet<>();
        while (!notifyQueue.isEmpty()) {
            int notifier = notifyQueue.poll();
            if (answer.contains(notifier)) {
                continue;
            }
            answer.add(notifier);
            Iterator<List<Integer>> teamIterator = list.iterator();
            while (true) {
                if (teamIterator.hasNext()) {
                    List<Integer> group = teamIterator.next();
                    if (group.contains(notifier)) {
                        notifyQueue.addAll(group);
                        teamIterator.remove();
                    }
                } else {
                    break;
                }
            }
        }
        System.out.println(answer.size());
    }

    public static void main3(String[] args) throws IOException {
        BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
        String[] line1 = reader.readLine().split(" ");
        int n = Integer.parseInt(line1[0]);
        int k = Integer.parseInt(line1[1]);
        HashMap<String, Integer> map = new HashMap<>(n);

        for (int i = 0; i < n; i++) {
            String line = reader.readLine();
            if (map.containsKey(line)) {
                int count = map.get(line);
                map.put(line, count + 1);
            } else {
                map.put(line, 1);
            }
        }

        ArrayList<Map.Entry<String, Integer>> list1 = new ArrayList<>(map.entrySet());
        Collections.sort(list1, (o1, o2) -> {

            if (o1.getValue().equals(o2.getValue())) {
                return o1.getKey().compareTo(o2.getKey());
            } else {
                return o1.getValue() - o2.getValue();
            }


        });

        ArrayList<Map.Entry<String, Integer>> list2 = new ArrayList<>(map.entrySet());
        Collections.sort(list2, (o1, o2) -> {
            if (o1.getValue().equals(o2.getValue())) {
                return o1.getKey().compareTo(o2.getKey());
            } else {
                return o2.getValue() - o1.getValue();
            }
        });


        for (int i = 0; i < k; i++) {
            Map.Entry tmp = list2.get(i);
            System.out.println(tmp.getKey() + " " + tmp.getValue());
        }
        for (int i = 0; i < k; i++) {
            Map.Entry tmp = list1.get(i);
            System.out.println(tmp.getKey() + " " + tmp.getValue());
        }
    }

    public static void mainxxx(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        PriorityQueue<Integer> heapMax = new PriorityQueue<>((o1, o2) -> o2 - o1);
        PriorityQueue<Integer> heapMin = new PriorityQueue<>(Comparator.comparingInt(i -> i));
        List<Integer> list = new ArrayList<>(n);
        for (int i = 0; i < n; i++) {
            Integer num = in.nextInt();
            list.add(num);
            heapMax.offer(num);
            if (heapMax.size() - heapMin.size() > 1) {
                heapMin.offer(heapMax.poll());
            }
        }
        in.close();
        heapMin.offer(Objects.requireNonNull(heapMax.poll()));
        heapMax.offer(Objects.requireNonNull(heapMin.poll()));
        for (Integer num : list) {
            if (heapMax.contains(num)) {
                System.out.println(heapMin.peek());
            } else {
                System.out.println(heapMax.peek());
            }
        }
    }

    public static class Node {
        public int val;
        public Node next;

        public Node(int x) {
            val = x;
        }

    }



}
